export default {
    name: 'OnplayComponent',
    components: {
        check: () =>
            import('../../../socical/socialCheck/check.vue')
    },
    data() {
        return {
            company: {
                name: '',
                createTime: [],
                begintime: '',
                endtime: ''
            },
            OnPlayCash: [{
                companyname: '',
                totalfee: '',
                rechargdate: '',
                accountname: '',
                accessoryid: '',
                handlername: ''
            }],
            Onplay: {
                total: 18,
                pageNum: 1,
                pageSize: 10
            },
            dialogVisible: false,
            uploadForm: {
                accname: '',
                accessoryid: '',
                filecontent: '',
                updownmark: '1'
            },
            imgbase64: '',
            loading: false,
            checkFlag: false,
            companyname: '',
            companyid: '',
        }
    },
    mounted() {
        this.getOnplayData();
    },
    methods: {
        getOnplayData() {
            if (this.company.begintime && this.company.endtime && Date.parse(this.company.begintime) > Date.parse(this.company.endtime)) {
                this.$message({
                    message: "结束时间不能早于开始时间",
                    type: "warning"
                });
                return;
            }
            this.loding = true;
            // if (this.company.begintime && this.company.endtime) {
            //     // this.company.begintime = this.company.createTime[0];
            //     // this.company.endtime = this.company.createTime[1]
            // } else {
            //     this.company.begintime = '';
            //     this.company.endtime = '';
            // }
            let obj = {
                companyname: this.company.name,
                begintime: this.company.begintime,
                endtime: this.company.endtime,
                pagenum: this.Onplay.pageNum,
            }
            this.$axios.post('/app/v1/platform/recharge/offlineList', obj).then(resp => {
                if (resp.data.message === 'success.') {
                    this.OnPlayCash = resp.data.data.list;
                    this.Onplay.total = parseInt(resp.data.data.totalnum);
                    this.loading = false;
                }
            })
        },
        SearchInfo() {
            this.Onplay.pageNum = 1;
            this.getOnplayData();
        },
        //线下充值记录分页查询
        OnplayCurrentChange(val) {
            this.Onplay.pageNum = val;
            this.getOnplayData();
        },
        LookInfo(row) {
            if (!row.accessoryid) {
                return;
            }
            this.uploadForm.accessoryid = row.accessoryid
            this.$axios.post('/system/v1/common/upAndDown', this.uploadForm).then(res => {
                this.imgbase64 = res.data.data.filecontent;
            });
            this.dialogVisible = true;
        },
        showCompanyInfo(row) {
            this.companyid = row.companyid;
            this.companyname = row.companyname;
            this.checkFlag = true;
        },
        handleSizeChange(val) {
            this.Onplay.pageSize = val;
            this.getOnplayData();

        }
    }
}